home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10540 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: antares.dfma.com!news
  2. From: johnb@dfma.com (John Breckenridge)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: String Question
  5. Date: Mon, 18 Mar 1996 18:56:45 GMT
  6. Organization: Boothroyd Dewhurst, Inc.
  7. Message-ID: <4ijv0j$9na@antares.dfma.com>
  8. References: <DoBt0E.4A9@freenet.carleton.ca> <4ie983$3v0@sparcserver.lrz-muenchen.de>
  9. NNTP-Posting-Host: johnb.dfma.com
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. watzka@stat.uni-muenchen.de (Kurt Watzka) wrote:
  13.  
  14. >aq436@FreeNet.Carleton.CA (Jerry Boyd) writes: 
  15. >>How would I write a function to remove a specified
  16. >>number of characters from a string and store it in an array.
  17.  
  18. >If you want to take part in the annual "reinvent the wheel" contest,
  19. >by copying a specified ...
  20.  
  21. >Otherwise, use strncpy(), but don't forget to hav a look at the
  22. >documentation for that function from the standard C library
  23. >first.
  24.  
  25. >>For instance, extracting three characters from a string, starting
  26. >>from the 5th character.
  27.  
  28. >    strncpy(dest, src + 5, 3);
  29. src + 5 is the 6th character!
  30. src + 4 would be the 5th character.
  31.  
  32. John Breckenridge                                Boothroyd Dewhurst, Inc.
  33. johnb@dfma.com                                   all opinions are my own
  34.  
  35.